package com.kitty.game.rank.model.record;

import lombok.Getter;
import lombok.Setter;

/**战力排行榜记录*/
@Setter
@Getter
public class ZhanLiRankRecord extends RankRecord {
    private String gid;
    private int zhanli;//防御
    private String partyName;//帮派名
    private String name;//角色名称
    private short polar;//门派 相性
    private short roleIcon;//角色图标
    private short level;//等级

    public ZhanLiRankRecord() {}

    public ZhanLiRankRecord(String gid, int zhanli, String partyName, String name, short polar, short roleIcon, short level) {
        this.gid = gid;
        this.zhanli = zhanli;
        this.partyName = partyName;
        this.name = name;
        this.polar = polar;
        this.roleIcon = roleIcon;
        this.level = level;
    }

    @Override
    public int compareTo(RankRecord o) {
        /**按防御从大到小排序*/
        ZhanLiRankRecord other = (ZhanLiRankRecord)o;
        if (zhanli != other.getZhanli()) {
            return zhanli > other.getZhanli() ? -1 : 1;
        }

        /**防御一样时，就按gid排序吧，保证不是同一个玩家就好了*/
        return gid.compareTo(other.getGid());
    }
}
